-
-
Notifications
You must be signed in to change notification settings - Fork 1
style: use clap derive feature #204
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Allows the CLI to be structured using nested structs and enums. Help messages are set using the doc strings for instance attributes. ## Behavioral changes Same behavior as before expect: * `-h` shows a shorter help message while `--help` shows the same long help message * `-extensions` will error if a blank string is passed. cpp-linter v1.x just silently ignores blank file extensions ## Other Changes - updated python dependencies (and uv.lock) - added support for fre-threaded python builds - adjusted docs' cli-gen binding accordingly for `-h` vs `--help` output (favoring the later when available). - adopt PEP639 about License info in Python package metadata.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #204 +/- ##
==========================================
- Coverage 96.87% 96.61% -0.26%
==========================================
Files 14 14
Lines 3131 2891 -240
==========================================
- Hits 3033 2793 -240
Misses 98 98 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
and rename subcommands struct to something more descriptive
20f2094 to
29e490c
Compare
2bndy5
added a commit
that referenced
this pull request
Nov 4, 2025
- Allow boolean options to be treated as flags if their default value is false.
- Some other CLI options can now accept no value (like a flag) including `--verbosity`
- Use `std::str::FromStr` trait to parse the given version:
* if no value is given, then behave exactly like the `cpp-linter version` subcommand (print version and exit)
* if a path is given look for clang-tools in that path. This only ensures the given path exists, not if the clang- tool is present; that is done later if the tool is needed.
* expand support for version specifiers using `semver::VersionReq`. This removes the need for `lenient_semver` dependency and allows the user to specify a range of clang versions. For example, `>=14, <16`, `=12.0.1`, or simply `16` (would be treated as `=16`). See [semver::VersionReq docs][ver-req-docs] for more detail.
- adjust docs to better describe accepted/possible values.
Due to the changes in parsing the user-given version, there is a new enum, `ClangTool` that enforces type-safety about finding the clang tools (when they are needed).
* Instead of passing the tool name (as a str), the `ClangTool` enum is used to avoid typos and convey explicit support for only clang-tidy and clang-format.
* Getting the clang tool's path and version are now instance methods of the `ClangTool` enum.
[ver-req-docs]: https://docs.rs/semver/1.0.27/semver/struct.VersionReq.html
2bndy5
added a commit
that referenced
this pull request
Nov 4, 2025
A follow-up to #204 - Allow boolean options to be treated as flags if their default value is false. - Some other CLI options can now accept no value (like a flag) including `--verbosity` - Use `std::str::FromStr` trait to parse the given version: * if no value is given, then behave exactly like the `cpp-linter version` subcommand (print version and exit) * if a path is given look for clang-tools in that path. This only ensures the given path exists, not if the clang- tool is present; that is done later if the tool is needed. * expand support for version specifiers using `semver::VersionReq`. This removes the need for `lenient_semver` dependency and allows the user to specify a range of clang versions. For example, `>=14, <16`, `=12.0.1`, or simply `16` (would be treated as `=16`). See [semver::VersionReq docs][ver-req-docs] for more detail. - adjust docs to better describe accepted/possible values. Due to the changes in parsing the user-given version, there is a new enum, `ClangTool` that enforces type-safety about finding the clang tools (when they are needed). * Instead of passing the tool name (as a str), the `ClangTool` enum is used to avoid typos and convey explicit support for only clang-tidy and clang-format. * Getting the clang tool's path and version are now instance methods of the `ClangTool` enum. [ver-req-docs]: https://docs.rs/semver/1.0.27/semver/struct.VersionReq.html
2bndy5
added a commit
that referenced
this pull request
Nov 4, 2025
A follow-up to #204 - Allow boolean options to be treated as flags (no value passed) if their default value is `false` (`--file-changes-only`, `--step-summary`, `--*-review`, etc). - Some other CLI options can now accept no value (like a flag) including `--verbosity` - Use `std::str::FromStr` trait to parse the given `--version`: * if no value is given, then behave exactly like the `cpp-linter version` subcommand (print version and exit) * if a path is given look for clang-tools in that path. This only ensures the given path exists, not if the clang- tool is present; that is done later if the tool is needed. * expand support for version specifiers using `semver::VersionReq`. This removes the need for `lenient_semver` dependency and allows the user to specify a range of clang versions. For example, `>=14, <16`, `=12.0.1`, or simply `16` (would be treated as `=16`). See [`semver::VersionReq` docs][ver-req-docs] for more detail. - adjust docs to better describe accepted/possible values. Due to the changes in parsing the user-given `--version`, there is a new enum, `ClangTool` that enforces type-safety about finding the clang tools (when they are needed). * Instead of passing the tool name (as a str), the `ClangTool` enum is used to avoid typos and convey explicit support for only clang-tidy and clang-format. * Getting the clang tool's path and version are now instance methods of the `ClangTool` enum. [ver-req-docs]: https://docs.rs/semver/1.0.27/semver/struct.VersionReq.html
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Allows the CLI to be structured using nested structs and enums. Help messages are set using the doc strings for instance attributes.
Behavioral changes
Same behavior as before except:
-hshows a shorter help message while--helpshows the same long help message-extensionswill error if a blank string is passed. cpp-linter v1.x just silently ignores blank file extensionsOther Changes
-hvs--helpoutput (favoring the later when available).